package com.byq.mm.smartlib.obd.commands.fuel;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;

import com.byq.mm.smartlib.obd.commands.AbstractObdCommand;
import com.byq.mm.smartlib.obd.commands.control.CommandEquivRatioObdCommand;
import com.byq.mm.smartlib.obd.commands.engine.EngineRPMObdCommand;
import com.byq.mm.smartlib.obd.commands.engine.SpeedObdCommand;
import com.byq.mm.smartlib.obd.commands.pressure.IntakeManifoldPressureObdCommand;
import com.byq.mm.smartlib.obd.commands.temperature.AirIntakeTemperatureObdCommand;


/** * TODO put description */
public class FuelEconomyWithoutMAFObdCommand extends AbstractObdCommand {
	public static final double AIR_FUEL_RATIO = 14.64;
	public static final double FUEL_DENSITY_GRAMS_PER_LITER = 720.0;

	public FuelEconomyWithoutMAFObdCommand() {
		super("");
	}

	/**
	 * * As it's a fake command, neither do we need to send request or read *
	 * response.
	 */
	@Override
	public void run(InputStream in, OutputStream out) throws IOException,
			InterruptedException {
		EngineRPMObdCommand rpmCmd = new EngineRPMObdCommand();
		rpmCmd.run(in, out);
		rpmCmd.getFormattedResult();
		AirIntakeTemperatureObdCommand airTempCmd = new AirIntakeTemperatureObdCommand();
		airTempCmd.run(in, out);
		airTempCmd.getFormattedResult();
		SpeedObdCommand speedCmd = new SpeedObdCommand();
		speedCmd.run(in, out);
		speedCmd.getFormattedResult();
		CommandEquivRatioObdCommand equivCmd = new CommandEquivRatioObdCommand();
		equivCmd.run(in, out);
		equivCmd.getFormattedResult();
		IntakeManifoldPressureObdCommand pressCmd = new IntakeManifoldPressureObdCommand();
		pressCmd.run(in, out);
		pressCmd.getFormattedResult();
		double imap = rpmCmd.getRPM() * pressCmd.getMetricUnit()
				/ airTempCmd.getKelvin();
	}

	@Override
	public String getFormattedResult() {
		return null;
	}

	@Override
	public String getName() {
		return null;
	}

	@Override
	public String getRequestKey() {
		// TODO Auto-generated method stub
		return null;
	}
}